package com.dk.testflow;

import com.dk.domain.ApiAutoTestEntity;
import com.dk.testcase.BaseCase;
import com.dk.util.String.StringUtil;
import com.dk.util.log.Log;

/**
 * 参数化执行
 */
public class ParameterizationLink extends ApiAutoTestChain{
    @Override
    public void executeTestChain(ApiAutoTestEntity apiAutoTestEntity) {
        Log.info("---【参数替换】:用例编号:"+apiAutoTestEntity.getCaseNum()+";用例名称:"+apiAutoTestEntity.getCaseName()+"--参数化替换参数开始");
        Log.info("---【参数替换】:开始替换url:");
        apiAutoTestEntity.setUrl(StringUtil.replacePatternAsVar(apiAutoTestEntity.getUrl(), BaseCase.varEntityMap));
        Log.info("---【参数替换】:开始替换headers:");
        apiAutoTestEntity.setHeaders(StringUtil.replacePatternAsVar(apiAutoTestEntity.getHeaders(), BaseCase.varEntityMap));
        Log.info("---【参数替换】:开始替换body:");
        apiAutoTestEntity.setBody(StringUtil.replacePatternAsVar(apiAutoTestEntity.getBody(), BaseCase.varEntityMap));
    }
}
